package com.raymond.queue.codec.encodeing;

import cn.hutool.core.util.ByteUtil;
import com.raymond.queue.common.codec.annotation.MsgCodec;
import com.raymond.queue.common.codec.encodeing.BaseEncoder;
import com.raymond.queue.common.enums.CommandIdType;
import com.raymond.queue.common.msg.BaseMessage;
import com.raymond.queue.common.msg.response.CreateTopicResponse;

/**
 * 创建topic响应编码器
 *
 * @author :  raymond
 * @version :  V1.0
 * @date :  2021-07-14 15:13
 */
@MsgCodec(commandId = CommandIdType.CREATE_TOPIC_RESP)
public class CreateTopicResponseEncoder extends BaseEncoder {

    @Override
    public byte[] encode0(BaseMessage msg) {
        CreateTopicResponse createTopicResponse = (CreateTopicResponse) msg;
        return ByteUtil.intToBytes(createTopicResponse.getCode());
    }
}
